package cn.haona.game.simb.servlet;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.UUID;

public class Util {

	/**
	 * 生成SessionID
	 * 
	 * @return
	 */
	public static String createSessionID() {
		return UUID.randomUUID().toString();
	}

	/**
	 * 从本地文件得到字符串
	 * @param fileName
	 * @return
	 */
	public static String getStringFromLoadFile(String fileName) {
		byte[] arrbFile = null;
		try {
			InputStream is;

			is = new FileInputStream(fileName);
			int size = is.available();
			// 文件byte[]
			arrbFile = new byte[size];
			is.read(arrbFile);
			is.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		// 字符串
		String strXML = new String(arrbFile);
		return strXML;
	}
}
